//输入两个数,求这两个数之间有多少个质数,并一一打印出来
import java.util.Scanner;
public class A11{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		System.out.println("请输入起始范围");
		int from = sc.nextInt();
		System.out.println("请输入结束范围");
		int to = sc.nextInt();
		int count = 0;
		for(int i = from;i <= to;i++){
			boolean flag = true;//注意:这行代码不能放在外面,否则每个数都会被判定为质数
			for(int j = 2;j < i;j++){
				if(i % j == 0){
					flag = false;
					break;
				}
			}
			if(flag){
				count++;
				System.out.println(i+"是质数");
			}
		}
		System.out.println(from+"和"+to+"之间一共有"+count+"个质数");
	}
}








